package com.yami.shop.seckill.common.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.app.dto.ShopCartOrderMergerDto;
import com.yami.shop.seckill.common.dto.SeckillOrderMergerDto;
import com.yami.shop.seckill.common.model.Seckill;
import com.yami.shop.seckill.common.model.SeckillOrder;

/**
 * 秒杀订单
 *
 * @author LGH
 * @date 2019-08-28 09:36:59
 */
public interface SeckillOrderService extends IService<SeckillOrder> {

    /**
     * 将确认的的订单信息缓存起来
     * @param userId
     * @param dto
     * @return
     */
    SeckillOrderMergerDto putConfirmOrderCache(String userId , SeckillOrderMergerDto dto);

    /**
     * 获取缓存的确认订单信息
     * @param userId
     * @return
     */
    SeckillOrderMergerDto getConfirmOrderCache(String userId);

    /**
     * 移除确认的订单的缓存
     * @param userId
     */
    void removeConfirmOrderCache(String userId);

    /**
     * 提交订单返回订单号
     * @param dto
     * @return
     */
    String submit(ShopCartOrderMergerDto dto);

    /**
     * 校验订单商品数量
     * @param seckill
     * @param userId
     * @param prodCount
     */
    void checkOrderProdNum(Seckill seckill,String userId, int prodCount);

    /**
     * 取消超时订单未支付订单
     */
    void cancelOrderUnpayOrderByTime();

    /**
     * 取消未支付订单
     * @param orderNumber
     */
    void cancelUnpayOrderByOrderNumber(String orderNumber);
}
